import { createFileRoute, redirect } from '@tanstack/react-router'
import { getUserInfo } from '@/hooks/use-user-data'
import SignIn from '@/features/auth/sign-in'

export const Route = createFileRoute('/(auth)/sign-in')({
  component: SignIn,
  beforeLoad: async () => {
    const userInfo = getUserInfo()
    if (userInfo) {
      throw redirect({ to: '/', replace: true })
    }
  },
})
